package com.example.finalwork2.controller;


import com.example.finalwork2.dto.WarnRequestItem;
import com.example.finalwork2.dto.WarningInfo;
import com.example.finalwork2.service.WarnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
public class WarnController {
    @Autowired
    private WarnService warnService;



    //直接调用service层的服务。
    @PostMapping("/warn")
    public List<WarningInfo> processWarnings(@RequestBody List<WarnRequestItem> requestList) {
        return warnService.processWarns(requestList);
    }
}
